<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<li class="<%= 'unpublished' if enrollment.course.created? || enrollment.course.claimed? %> <%= enrollment.state_based_on_date %> clearfix">

  <a href="<%= course_user_path(enrollment.course_id, enrollment.user_id) %>" style="float: left; max-width: 800px;">
    <span class="name" title="<%= enrollment.long_name(@current_user) %>">
      <%= enrollment.long_name(@current_user) %>
      <% if enrollment.course.created? || enrollment.course.claimed? %>
        <i class="icon-unpublish" title="{{#t}}This course hasn't been published yet{{/t}}"></i>
      <% end %>
    </span>

    <% unless enrollment.course.enrollment_term.default_term? %>
      <span class="subtitle ellipsis"><%= enrollment.course.enrollment_term.name %></span>
    <% end %>

    <span class="subtitle ellipsis">
      <%= Enrollment.workflow_readable_type(enrollment.readable_state_based_on_date) %>,
      <%=
        case enrollment.class.to_s
        when 'TeacherEnrollment'
          t('roles_teacher', "Enrolled as a Teacher.")
        when 'StudentEnrollment'
          t('roles_student', "Enrolled as a Student.")
        when 'TaEnrollment'
          t('roles_ta', "Enrolled as a TA.")
        when 'ObserverEnrollment'
          t('roles_observer', "Enrolled as an Observer.")
        when 'DesignerEnrollment'
          t('roles_designer', "Enrolled as a Designer.")
        else
          t('roles_student', "Enrolled as a Student.")
        end
      %>

      <% if enrollment.associated_user %>
        <%= t('linked_to_user', '(Linked to %{user_name})', :user_name => enrollment.associated_user.name) %>
      <% end %>
    </span>
  </a>
  <span style="float: right; margin-right: 5px; margin-top: 3px;">
    <a href="#" rel="<%= course_unenroll_url(enrollment.course_id, enrollment.id) %>" class="unenroll_link" role="button">
      <i class="icon-end standalone-icon"></i>
      
    </a>
  </span>
  <% if enrollment.admin? && can_do(enrollment.user, @current_user, :read_reports) %>
    <div style='clear:left'>
      <%= link_to(t('links.teacher_activity', 'See Student Interactions Report'), user_course_teacher_activity_url(enrollment.user_id, enrollment.course_id)) %>
    </div>
  <% end %>
  <span class="clear"></span>
</li>
